package com.heima.admin.controller.v1;

import com.heima.feign.wemedia.INewsClient;
import com.heima.model.apuser.dtos.NewsAuthDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author rookie001
 * @creat 2023-06-20-15:52
 */
@RestController
@RequestMapping("/api/v1/news")
@Slf4j
public class AdNewsController {
    @Autowired
    private INewsClient iNewsClient;

    //文章分页查询
    @PostMapping("list_vo")
    public ResponseResult getNewsList(@RequestBody NewsAuthDto dto) {
        return iNewsClient.getNewsList(dto);
    }

    //查询详情
    @GetMapping("one_vo/{id}")
    ResponseResult getNewsDetail(@PathVariable("id") Integer id){
        return iNewsClient.getNewsDetail(id);
    }
    //文章审核驳回
    @PostMapping("auth_fail")
    ResponseResult auditReject(@RequestBody NewsAuthDto dto){
        return iNewsClient.auditReject(dto);
    }
    //文章审核通过
    @PostMapping("auth_pass")
    ResponseResult auditPass(@RequestBody NewsAuthDto dto){
        return iNewsClient.auditPass(dto);
    }
}
